﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SerializeDeserialize
{
    [Serializable]
    public class Persons
    {
        public List<Person> personList = new List<Person>();

        public Persons(IEnumerable<Person> persons)
        {
            personList = (List<Person>)persons;
        }

        public Persons()
        {
        }
    }

    [Serializable]
    public class Account
    {
        public Account(string bankName, int accountNum)
        {
            this.BankName = bankName;
            this.AccountNumber = accountNum;
        }

        public Account()
        {
            
        }
    
        public string BankName
        {
            get;
            set;
        }

        public int AccountNumber
        {
            get;
            set;
        }
        
    }

    [Serializable]
    public class Person
    {
        public List<Account> Accounts = new List<Account>();

        public string FirstName
        {
            get;
            set;
        }

        public string Lastname
        {
            get;
            set;
        }

        public string Sex
        {
            get;
            set;
        }

        public int Age
        {
            get;
            set;
        }

        public Person(string firstName, string lastName, string sex, int age, List<Account> accounts)
        {
            this.FirstName = firstName;
            this.Lastname = lastName;
            this.Sex = sex;
            this.Age = age;

            this.Accounts = accounts;
        }

        public Person()
        {
        }
    }
}
